Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#Org.apache.hc.core5.http.message.ParserCursor' - 1 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of org.apache.hc.core5.http.message.ParserCursor

    public void testParamByName() throws Exception {

final String s = "name = value; param1 = value1; param2 = value2";

final CharArrayBuffer buf = new CharArrayBuffer(64);

buf.append(s);

final ParserCursor cursor = new ParserCursor(0, buf.length());

final HeaderElement element = BasicHeaderValueParser.INSTANCE.parseHeaderElement(buf, cursor);

Assert.assertEquals("value1", element.getParameterByName("param1").getValue());

Assert.assertEquals("value2", element.getParameterByName("param2").getValue());

Assert.assertNull(element.getParameterByName("param3"));

try {

element.getParameterByName(null);

Assert.fail("IllegalArgumentException should have been thrown");

} catch (final IllegalArgumentException ex) {

}

}


   Like      Feedback      org.apache.hc.core5.http.message.ParserCursor



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner